package vista;
import java.awt.BorderLayout;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;

import javax.swing.WindowConstants;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import javax.swing.SwingUtilities;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class VentanaListadoIngrediente extends javax.swing.JFrame {
	private JPanel panListadoIngrediente;
	private JLabel lblListado;
	private JScrollPane scpListadoIngrediente;
	private JTable tblListadoIngrediente;
	private JButton btnSalir;
	private JButton btnLimpiar;
	
	public VentanaListadoIngrediente() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			setTitle("Ingredientes");
			{
				panListadoIngrediente = new JPanel();
				getContentPane().add(panListadoIngrediente, BorderLayout.CENTER);
				panListadoIngrediente.setLayout(null);
				panListadoIngrediente.setBackground(new java.awt.Color(255,255,255));
				{
					lblListado = new JLabel();
					panListadoIngrediente.add(lblListado);
					lblListado.setText("Listado de Ingredientes y su Disponibilidad");
					lblListado.setBounds(51, 34, 269, 23);
					lblListado.setForeground(new java.awt.Color(18,6,249));
					lblListado.setFont(new java.awt.Font("Comic Sans MS",1,12));
				}
				{
					scpListadoIngrediente = new JScrollPane();
					panListadoIngrediente.add(scpListadoIngrediente);
					scpListadoIngrediente.setBounds(51, 83, 471, 250);
					{
						TableModel tblListadoIngredienteModel = 
							new DefaultTableModel();
						tblListadoIngrediente = new JTable();
						scpListadoIngrediente.setViewportView(tblListadoIngrediente);
						tblListadoIngrediente.setModel(tblListadoIngredienteModel);
					}
				}
				{
					btnLimpiar = new JButton();
					panListadoIngrediente.add(btnLimpiar);
					btnLimpiar.setText("Limpiar");
					btnLimpiar.setBounds(145, 357, 112, 31);
					btnLimpiar.setForeground(new java.awt.Color(252,221,3));
					btnLimpiar.setBackground(new java.awt.Color(18,6,249));
					btnLimpiar.setFont(new java.awt.Font("Comic Sans MS",1,12));
				}
				{
					btnSalir = new JButton();
					panListadoIngrediente.add(btnSalir);
					btnSalir.setText("Salir");
					btnSalir.setBounds(296, 357, 112, 31);
					btnSalir.setForeground(new java.awt.Color(252,221,3));
					btnSalir.setBackground(new java.awt.Color(18,6,249));
					btnSalir.setFont(new java.awt.Font("Comic Sans MS",1,12));
				}
			}
			pack();
			this.setSize(583, 458);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	
	public void addListener(ActionListener actionListener){
		btnLimpiar.addActionListener(actionListener);
		btnSalir.addActionListener(actionListener);
	}
	
	public void setResultados(AbstractTableModel abstractTableModel) {
		tblListadoIngrediente.setModel(abstractTableModel);
	}
	
	public void limpiarTabla(){
		TableModel tblListadoIngredienteModel = 
			new DefaultTableModel();
		tblListadoIngrediente.setModel(tblListadoIngredienteModel);
	}

}
